<%--
 * Copyright (c) 2013 Andaily Information Technology Co. Ltd
 * www.andaily.com
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Andaily Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with Andaily Information Technology Co. Ltd.
--%>
<%--
 * 
 * @author Shengzhao Li
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../comm-header.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="${contextPath}/resources/jquery-1.9.1.min.js"></script>

<style type="text/css">  
    body{background: url("${contextPath}/resources/img/login_bg.jpg") no-repeat;font-size: 16px;background-size:cover;height:100%;width: 100%; overflow:-Scroll;overflow-y:hidden;background-attachment: fixed;}  
    .form{background: rgba(255,255,255,0.2);width:300px;margin:180px auto;border-radius:5px;-moz-border-radius:5px; /* Old Firefox */}  
    #login_form{display: block;}  
    #register_form{display: none;}  
    .fa{display: inline-block;top: 27px;left: 6px;position: relative;color: #ccc;}  
    input[type="text"],input[type="password"]{padding-left:26px;}  
    .checkbox{padding-left:21px;}  
</style>  
<script type="text/javascript">
$(function(){
	var url=window.location.href;
	if(url.indexOf('?')<0){
		var error=$("[name='oauth_login_error']").val();
		var client_id=$("[name='client_id']").val();
		var redirect_uri=$("[name='redirect_uri']").val();
		var response_type=$("[name='response_type']").val();
		var scope=$("[name='scope']").val();
		var state=$("[name='state']").val();
		url=url+"?client_id="+client_id+"&redirect_uri="+redirect_uri+"&response_type="+response_type+"&scope="+scope+"&state="+state;
		if(error&&url.indexOf('?')>0){
			url=url+"&error="+error;
		}
		window.location.replace(url);
	}
	if(url.indexOf('&error=true')>0){
		$("#rightInfoId").hide();
		$("#falseInfoId").show();
	}else{
		$("#rightInfoId").show();
		$("#falseInfoId").hide();
	}
});
</script>
</head>
<body>

<div class="container">  
    <div class="form row">  
        <form class="form-horizontal col-xs-offset-2 col-sm-offset-2 col-md-offset-2" id="login_form" action="${pageContext.request.contextPath}/oauth/authorize" method="post">
            <input type="hidden" name="client_id" value="${param.client_id}"/>
            <input type="hidden" name="scope" value="${param.scope}"/>
            <input type="hidden" name="response_type" value="${param.response_type}"/>
            <input type="hidden" name="redirect_uri" value="${param.redirect_uri}"/>
            <input type="hidden" name="state" value="${param.state}"/>
            <input type="hidden" name="client_secret" value="${param.client_secret}"/>
            <input type="hidden" name="oauth_login_error" value="${oauth_login_error}"/>
            <div class="col-xs-12 col-sm-12 col-md-12">  
           		<h3 class="form-title">安居小宝登录认证</h3>  
            </div>
            <div class="col-xs-10 col-sm-10 col-md-10">  
                <div class="form-group">  
                    <i class="fa fa-user fa-lg"></i>  
                    <input class="form-control required" required="required" type="text" placeholder="用户名" name="username" autofocus="autofocus" maxlength="20"/>  
                </div>  
                <div class="form-group">  
                     <i class="fa fa-lock fa-lg"></i>  
                     <input class="form-control required" required="required" type="password" placeholder="密码" name="password" maxlength="20"/>  
                </div>  
                <div class="form-group">  
                	<span id="rightInfoId">填写用户名和密码</span>
                    <span id="falseInfoId" style="color:red;display: none">用户名或密码错误</span> 
                    <input type="submit" class="btn btn-success pull-right" value="登录 "/>     
                </div>  
            </div>  
        </form>  
    </div>  
</div>

<%--<div class="container">
	 <div class="" style="text-align: center;">
		<div class="row" style="margin-top: 20px;">
			<div>
			    <h3>商铺报警登录认证</h3>
			</div>
		</div>
	    <div class="row" style="margin-top: 20px;">
	        <div class="col-md-10">
	            <form action="${pageContext.request.contextPath}/oauth/authorize" method="post" class="form-horizontal">
	                <input type="hidden" name="client_id" value="${param.client_id}"/>
	                <input type="hidden" name="scope" value="${param.scope}"/>
	                <input type="hidden" name="response_type" value="${param.response_type}"/>
	                <input type="hidden" name="redirect_uri" value="${param.redirect_uri}"/>
	                <input type="hidden" name="state" value="${param.state}"/>
	                <input type="hidden" name="client_secret" value="${param.client_secret}"/>
	
	                <div class="form-group">
	                    <label class="col-sm-3 col-xs-3 control-label">用户名：</label>
	
	                    <div class="col-sm-8 col-xs-8">
	                        <input type="text" name="username" value="" required="required" class="form-control"
	                               placeholder="用户名"/>
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-3 col-xs-3 control-label">密码：</label>
	
	                    <div class="col-sm-8 col-xs-8">
	                        <input type="password" name="password" required="required" class="form-control"
	                               placeholder="密码"/>
	                    </div>
	                </div>
	                <div class="form-group">
	                	<div class="col-sm-offset-2 col-sm-10">
	                        <span style="color:red;"><c:if test="${not empty oauth_login_error}">用户名或密码错误</c:if></span>
	                	</div>
	                    <div class="col-sm-offset-2 col-sm-10">
	                        <input type="submit" value="登录" class="btn btn-primary"/>
	                    </div>
	                </div>
	            </form>
	        </div>
	    </div>
	</div> --%>
    <%--<form action="${pageContext.request.contextPath}/oauth/authorize" method="post">--%>
    <%--<input type="hidden" name="client_id" value="${param.client_id}"/>--%>
    <%--<input type="hidden" name="scope" value="${param.scope}"/>--%>
    <%--<input type="hidden" name="response_type" value="${param.response_type}"/>--%>
    <%--<input type="hidden" name="redirect_uri" value="${param.redirect_uri}"/>--%>
    <%--<input type="hidden" name="state" value="${param.state}"/>--%>
    <%--<input type="hidden" name="client_secret" value="${param.client_secret}"/>--%>

    <%--Username: <input type="text" name="username" value="" required="required"/>--%>
    <%--<br/> <br/>--%>
    <%--Password: <input type="password" name="password" required="required"/>--%>
    <%--<br/> <br/>--%>
    <%--<input type="submit" value="Login" class="btn btn-primary"/>--%>
    <%--<br/>--%>
    <%--<span style="color:red;"><c:if test="${not empty oauth_login_error}">Login failed</c:if></span>--%>
    <%--</form>--%>
<!--</div>

 <div>
    <br/>

    <p>可以使用下面的账号登录或使用你自行添加的账号:</p>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>username</th>
            <th>password</th>
            <th>grant_types</th>
            <th>roles</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>test</td>
            <td>test</td>
            <td>authorization_code,password,refresh_token,client_credentials</td>
            <td>User(id=22)</td>
        </tr>
        </tbody>
    </table>
</div> -->
</body>
</html>